package cn.itsource.pojo.ro;

import cn.hutool.core.bean.BeanUtil;
import cn.itsource.pojo.domain.Order;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
public class CreateOrderRo {
    //开始位置信息
    @NotEmpty(message = "起始位不能为空")
    private String startPlace;
    @NotEmpty(message = "起始位不能为空")
    private String startPlaceLongitude;
    @NotEmpty(message = "起始位不能为空")
    private String startPlaceLatitude;
    //结束位置信息
    @NotEmpty(message = "结束位不能为空")
    private String endPlace;
    @NotEmpty(message = "结束位不能为空")
    private String endPlaceLongitude;
    @NotEmpty(message = "结束位不能为空")
    private String endPlaceLatitude;
    //车辆信息
    @NotEmpty(message = "车牌号不能为空")
    private String carPlate;
    @NotEmpty(message = "车型不能为空")
    private String carType;
    //距离，时长
    @NotNull(message = "距离不能为空")
    private BigDecimal expectsMileage;
    @NotNull(message = "时长位不能为空")
    private Integer expectMinutes;
    private Double favourAmount;

    public static Order orderRoToOrder(CreateOrderRo createOrderRo){
        Order order = new Order();
        BeanUtil.copyProperties(createOrderRo,order);
        return order;
    }
}
